﻿using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Windows.Data;
namespace WPFExcelReport
{
    public partial class TKAD06
    {
        #region ==LIEFSCH===========
        public static readonly DependencyProperty LIEFSCHProperty = DependencyProperty.Register("LIEFSCH",
            typeof(string), typeof(TKAD06),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnLIEFSCHChanged));
        public string LIEFSCH
        {
            get
            {
                return (string)GetValue(LIEFSCHProperty);
            }
            set
            {
                SetValue(LIEFSCHProperty, value);
            }
        }
        private static void OnLIEFSCHChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as TKAD06;
            if (src != null)
            {
                src.LIEFSCH = (string)e.NewValue;
                src.Load();
            }
        }
        #endregion 
 
        public TKAD06()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VKUNDADR();
            DataContext = MV;
            InitializeComponent();  
        }  

        public void Load()
        {
          
            dwData = VVVLIEF.Instance.TBMain.NewRow();
            dwData["VVMANDANT"] = app.Mandant;
            dwData["VVLIEFSCH"] = LIEFSCH;
            SResult = TMV.QueryKUNDADR(dwData, 3);
            MergeData(SResult,true);
        }
    }
}